/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tesoreria.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.colegiatura.be.Colegiado;
import org.cip.esymons.tesoreria.be.FondoMortuorio;

/**
 *
 * @author Ingrid Capuñay
 */
public class FondoMortuorioDelegate {
    private FondoMortuorioFacadeLocal local;

    public FondoMortuorioDelegate() {
        local = lookupFondoMortuorioFacade();
    }

    public void remove(FondoMortuorio fondoMortuorio) {
        local.remove(fondoMortuorio);
    }

    public List<FondoMortuorio> findAll() {
        return local.findAll();
    }

    public FondoMortuorio find(Object id) {
        return local.find(id);
    }

    public void edit(FondoMortuorio fondoMortuorio) {
        local.edit(fondoMortuorio);
    }

    public void create(FondoMortuorio fondoMortuorio) {
        local.create(fondoMortuorio);
    }

    public List<FondoMortuorio> fondosMortuoriosVigentes(){
        return local.fondosMortuoriosVigentes();
    }

    public FondoMortuorio buscarFondoExistente(Colegiado cole){
        return local.buscarFondoExistente(cole);
    }
    

    private FondoMortuorioFacadeLocal lookupFondoMortuorioFacade() {
        try {
            Context c = new InitialContext();
            return (FondoMortuorioFacadeLocal) c.lookup("java:comp/env/FondoMortuorioFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }


}
